package com.zjxny.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.upms.handler.DictCodeChoiceFetchHandler;
import xyz.erupt.upms.model.base.HyperModel;

@Setter
@Getter
@Entity
@Table(name = "sms_history")
@Erupt(
		name = "短信信息"
		,power = @Power(
				add = false, 
				delete = false, 
				edit = false,
				query = true, 
				importable = false, 
				export = true
		)
)
public class SmsHistory extends HyperModel{
	
	private static final long serialVersionUID = 1012140795811072565L;

	@EruptField(
			views = @View(title = "短信模板编码")
			,edit = @Edit(
					title="短信模板编码"
					,type = EditType.INPUT
					,show = false
				)
	)
	@Column(name = "tpl_code", columnDefinition="varchar(30)")
	private String tplCode;
	
	@EruptField(
			views = @View(title = "短信模板名称")
			,edit = @Edit(
					title="短信模板名称"
					,type = EditType.INPUT
					,show = false
					,search = @Search(vague = true)
				)
		)
	@Column(name = "tpl_name", columnDefinition="varchar(15)")
	private String tplName;
	
	@EruptField(
			views = @View(title = "客户姓名")
			,edit = @Edit(
					title="客户姓名"
					,type = EditType.INPUT
					,show = false
					,search = @Search(vague = true)
				)
		)
	@Column(name = "user_name", columnDefinition="varchar(30)")
	private String userName;
	
	
	@EruptField(
			views = @View(title = "手机号码")
			,edit = @Edit(
					title="手机号码"
					,type = EditType.INPUT
					,show = false
					,search = @Search(vague = true)
				)
		)
	@Column(name = "phone_no", columnDefinition="varchar(15)")
	private String phoneNo;
	
	@EruptField(
			views = @View(title = "号牌号码")
			,edit = @Edit(
					title="号牌号码"
					,type = EditType.INPUT
					,search = @Search(vague = true)
				)
	)
	@Column(name = "hphm", columnDefinition="varchar(10)")
	private String hphm;
	
	@EruptField(
			views = @View(title = "违法文书号")
			,edit = @Edit(
					title="违法文书号"
					,type = EditType.INPUT
					,search = @Search(vague = true)
				)
	)
	@Column(name = "xh", columnDefinition="varchar(20)")
	private String xh;
	
	@EruptField(
			views = @View(title = "短信内容")
			,edit = @Edit(
					title="短信内容"
					,type = EditType.INPUT
					,notNull = true
				)
	)
	@Column(name = "content", columnDefinition="text")
	private String content;
	
	@EruptField(
			views = @View(title = "短信状态")
			, edit = @Edit(
                    title = "短信状态"
                    ,search = @Search
                    ,type = EditType.CHOICE
        			,choiceType=@ChoiceType(fetchHandler = DictCodeChoiceFetchHandler.class,fetchHandlerParams = {"traffic_sms_status_his"} ) 
            )
	)
	private Integer status;
	
	@EruptField(
			views = @View(title = "失败描述")
			, edit = @Edit(
				title = "失败描述"
			)
	)
	@Column(name = "error_msg", columnDefinition="text")
	private String errorMsg;
	
	@EruptField(
			views = @View(title = "短信通道响应",show = false)
			,edit = @Edit(
					title="短信通道响应"
					,type = EditType.INPUT
					,notNull = true
				)
	)
	@Column(name = "response", columnDefinition="text")
	private String response;
	
	@EruptField(
			views = @View(title = "发送日期")
			, edit = @Edit(
				title = "发送日期"
				,search=@Search(vague=true),type = EditType.DATE, dateType = @DateType(type = DateType.Type.DATE)
			)
	)
	@Column(name = "last_send_time", columnDefinition="datetime")
	private String lastSendTime;
}
